module.exports = (cls, name)->
    fn = cls[name]
    (args...)->
        return new Promise(
            (resolve, reject) =>
                args.push (r)->resolve(r)
                try
                    fn.apply cls, args
                catch error
                    reject error
        )
